<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
      xmlns:f="http://xmlns.jcp.org/jsf/core">
    <h:head>
        <title>Warehouses Management</title>
    </h:head>
    <h:body>
        <f:view contracts="main">
            <ui:composition template="/template.xhtml">
                <ui:define name="content" id="mycontent">
                    <h:form>
                        <p:commandButton value="add new Warehouse" type='button' onclick="PF('addWarehouse').show();"/>
                        <p:dialog widgetVar="addWarehouse"  width="400" height="350" header="Add Warehouse">

                            <ui:include src="/WEB-INF/dialogs/newWarehouse.xhtml"/>

                        </p:dialog>
                        <p:dataTable id="warehouses" var="warehouse" value="#{warehousesController.all}">
                            <p:column headerText="Warehouse Name" sortBy="name" filterBy="name" filterMatchMode="contains"> 
                                <h:outputText value="#{warehouse.name}" /> 
                            </p:column>
                            
                            <p:column headerText="View Details"> 
                                <p:commandButton  value="view details"/>
                            </p:column>

                        </p:dataTable>




                    </h:form>
                </ui:define>
            </ui:composition>
        </f:view>
    </h:body>
</html>

